import type { AddressParams, AddressItem } from '@/types/Contact'
import { http } from '@/utils/http'

/**
 * 添加
 * @param data 请求参数
 */
export const postMemberAddressAPI = (data: AddressParams) => {
  return http({
    method: 'POST',
    url: '/user/user/bindContact',
    data,
  })
}
/**
 * 获取联系人列表
 */
export const getMemberContactAPI = (userId:any) => {
  return http<AddressItem[]>({
    method: 'GET',
    url: `/user/user/viewBindContact/${userId}`,
    data:userId
  })
}
/**
 * 获取详情
 * @param id id(路径参数)
 */
export const getMemberAddressByIdAPI = (id: string) => {
  return http<AddressItem>({
    method: 'GET',
    url: `/member/address/${id}`,
  })
}
/**
 * 修改
 * @param id id(路径参数)
 * @param data 表单数据(请求体参数)
 */
export const putMemberAddressByIdAPI = (id: string, data: AddressParams) => {
  return http({
    method: 'PUT',
    url: `/member/address/${id}`,
    data,
  })
}
/**
 * 删除
 * @param id
 */
export const deleteMemberAddressByIdAPI = (userId: string) => {
  return http({
    method: 'POST',
    url: `/user/user/unBindContact/${userId}`,
    userId
  })
}
